/**
 * @mbggenerated
 * @author wujian
 */
package bearworker.zxl.dao.mapper;

import bearworker.zxl.entity.DeliveryOrder;
import org.apache.ibatis.jdbc.SQL;

public class DeliveryOrderSqlProvider {

    /* @mbggenerated */
    public String insertSelective(DeliveryOrder record) {
        return new SQL() {
            {
                INSERT_INTO("delivery_order");

                if (record.getOrderNo() != null) {
                    VALUES("order_no", "#{orderNo,jdbcType=VARCHAR}");
                }

                if (record.getSenderId() != null) {
                    VALUES("sender_id", "#{senderId,jdbcType=INTEGER}");
                }

                if (record.getOriginalPrice() != null) {
                    VALUES("original_price", "#{originalPrice,jdbcType=INTEGER}");
                }

                if (record.getPayPrice() != null) {
                    VALUES("pay_price", "#{payPrice,jdbcType=INTEGER}");
                }

                if (record.getDiscountPrice() != null) {
                    VALUES("discount_price", "#{discountPrice,jdbcType=INTEGER}");
                }

                if (record.getDiscountWayId() != null) {
                    VALUES("discount_way_id", "#{discountWayId,jdbcType=INTEGER}");
                }

                if (record.getWechatPayNo() != null) {
                    VALUES("wechat_pay_no", "#{wechatPayNo,jdbcType=VARCHAR}");
                }

                if (record.getState() != null) {
                    VALUES("state", "#{state,jdbcType=TINYINT}");
                }

                if (record.getCreateTime() != null) {
                    VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
                }

            }
        }.toString();
    }

    /* @mbggenerated */
    public String updateByPrimaryKeySelective(DeliveryOrder record) {
        return new SQL() {
            {
                UPDATE("delivery_order");

                if (record.getOrderNo() != null) {
                    SET("order_no = #{orderNo,jdbcType=VARCHAR}");
                }

                if (record.getSenderId() != null) {
                    SET("sender_id = #{senderId,jdbcType=INTEGER}");
                }

                if (record.getOriginalPrice() != null) {
                    SET("original_price = #{originalPrice,jdbcType=INTEGER}");
                }

                if (record.getPayPrice() != null) {
                    SET("pay_price = #{payPrice,jdbcType=INTEGER}");
                }

                if (record.getDiscountPrice() != null) {
                    SET("discount_price = #{discountPrice,jdbcType=INTEGER}");
                }

                if (record.getDiscountWayId() != null) {
                    SET("discount_way_id = #{discountWayId,jdbcType=INTEGER}");
                }

                if (record.getWechatPayNo() != null) {
                    SET("wechat_pay_no = #{wechatPayNo,jdbcType=VARCHAR}");
                }

                if (record.getState() != null) {
                    SET("state = #{state,jdbcType=TINYINT}");
                }

                if (record.getCreateTime() != null) {
                    SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
                }

                WHERE("id = #{id,jdbcType=INTEGER}");

            }
        }.toString();
    }
}